package com.example.ssm.dao;

import com.example.ssm.entity.Bill;
import com.example.ssm.entity.Menu;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import java.sql.SQLException;
import java.util.List;

public interface MenuDao {
@Insert("insert into onlinesys.menu(name, shop_name, price, type) VALUES (#{name},#{shop_name},#{price},#{type})")
   boolean insertMennu(Menu menu);

@Select("select *from onlinesys.menu where shop_name=#{shop_name}")
   List<Menu> selectMenuByShopName(String shop_name);

@Delete("delete from onlinesys.menu where id=#{id}")
   boolean delMenu(Menu menu);

   @Select("select *from onlinesys.menu")
   List<Menu>  selectAllMenu();

   @Select("select *from onlinesys.menu where id=#{shopid}")
   List<Menu> selectMenuById(Bill bill);

//模糊查询
   @Select("select * from onlinesys.menu where type=#{type} and shop_name like concat('%',#{shop_name},'%')")
   List<Menu> selectTypeshop_name(Menu menu);//Typeshop_name


   @Select("select * from onlinesys.menu where type=#{type} and name like concat('%',#{name},'%')")
   List<Menu> selectTypeName(Menu menu);//TypeName

   @Select("select * from onlinesys.menu where type=#{type} and price<=#{price}")
   List<Menu> selectTypeprice(Menu menu);//Typeprice

   @Select("select * from onlinesys.menu where type=#{type} and shop_name like concat('%',#{shop_name},'%') and name like concat('%',#{name},'%')")
   List<Menu> selectTypepshop_namename(Menu menu);//Typepshop_namename

   @Select("select * from onlinesys.menu where type=#{type} and price<=#{price} and name like concat('%',#{name},'%')")
   List<Menu> selectTypeppricename(Menu menu);//Typeppricename

   @Select("select * from onlinesys.menu where type=#{type} and price<=#{price} and shop_name like concat('%',#{shop_name},'%')")
   List<Menu> selectTypeppriceshop_name(Menu menu);//Typeppriceshop_name



   @Select("select *from onlinesys.menu where type=#{type}")
   List<Menu> selectType(Menu menu);


}
